Learn R Programming

PanelMatch (version 3.0.0)

[.PanelBalance: Subset PanelBalance objects

Description

Subset PanelBalance objects

Usage

# S3 method for PanelBalance
[(x, i, ...)

Value

Returns balance information for specified PanelMatch configuration. Note that results are still returned as a PanelBalance object. In order to return a list, use the [[ operator

Arguments

x

PanelBalance object

i

numeric. Specifies which element to extract. Substantively, it specifies which PanelMatch configuration data to extract.

...

Not used

Examples

Run this code
dem$rdata <- runif(runif(nrow(dem)))
dem.panel <- PanelData(dem, "wbcode2", "year", "dem", "y")
pm.obj <- PanelMatch(lead = 0:3, lag = 4, refinement.method = "mahalanobis", 
                     panel.data = dem.panel, match.missing = TRUE,
                     covs.formula = ~ tradewb + rdata + I(lag(tradewb, 1:4)) + I(lag(y, 1:4)), 
                     size.match = 5, qoi = "att")

# create multiple configurations to compare
pm2 <- PanelMatch(lead = 0:3, lag = 4, refinement.method = "ps.match", 
                  panel.data = dem.panel, match.missing = TRUE,
                  covs.formula = ~ tradewb + rdata + I(lag(tradewb, 1:4)) + I(lag(y, 1:4)), 
                  size.match = 5, qoi = "att")

pb <- get_covariate_balance(pm.obj, pm2,
                            include.unrefined = TRUE,
                            panel.data = dem.panel, 
                            covariates = c("tradewb", "rdata"))
bal.maha <- pb[1]
bal.ps <- pb[2]                             

Run the code above in your browser using DataLab